/* components */
import { AuthListItem } from '@src/modules/account/role/component'
/* enum */
import ComponentNameEnum from '@model/enum/ComponentNameEnum'
/* model */
import { AuthTreeNode } from '@src/modules/account/role/component/AuthTree/model'
/* scss */
import '@src/modules/account/role/component/AuthList/index.scss'
/* vue */
import { ComponentInstance, computed, defineComponent, PropType } from 'vue'

export type AuthListProps = {
  data: AuthTreeNode[];
  disabled: boolean;
}

export interface AuthListSetupState {
  
}

export enum AuthListEventEnum {
  Input = 'input',
  Submit = 'submit',
}

export type AuthListEmitsOptions = {
  input: () => void;
}

export type AuthListInstance = ComponentInstance & AuthListSetupState
export type AuthListVM = AuthListSetupState & AuthListProps & ComponentInstance

export default defineComponent({
  name: ComponentNameEnum.AuthList,
  emits: [
    AuthListEventEnum.Input,
    AuthListEventEnum.Submit,
  ],
  props: {
    data: {
      type: Array as PropType<AuthTreeNode[]>,
      default: () => []
    },
    disabled: {
      type: Boolean,
      default: false
    }
  },
  setup(props: AuthListProps, { slots, emit }) {
    
  },
  render() {
    return (
      <div class={ComponentNameEnum.AuthList}>
        
        {this.data.map(item => {
          return <AuthListItem data={item} disabled={this.disabled} />
        })}
        
      </div>
    ) as any
  }
}) as any
